<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title></title>
</head>
<body>
	<script type="text/javascript">
		var arr=["a","b",{ name:'afei' , age:100 }];
		var obj={
			title:'CEO',
			level:0,
			email:'ceo@xxx.com',
			item:[{
				son:'t1'
			},{
				son:'t2'
			}]
		};
		//var obj={};
		
		
		function isArray(inArray){
			//return typ
		}
		function each(inMix,inCallback,inContext){
			if(inMix instanceof Array){
				forEach(inMix,inCallback,inContext);
			}else{
				for(var i in inMix){
					inCallback.call(inContext,inMix[i],i);
				}
			}
		}
		
		function forEach(inArray,inCallback,inContext){
			if(inArray.forEach){
				inArray.forEach(inCallback,inContext);
			}else{
				for(var i=0,len=inArray.length;i<len;i++){
					inCallback.call(inContext,inArray[i],i);
				}
			}
		}
		//优化得到，try...catch性能问题？
		function forEach2(inArray,inCallback,inContext){
			try{
				inArray.forEach(inCallback,inContext);
			}catch(_){
				var i=0,len=inArray.length
				for(;i<len;i++){
					inCallback.call(inContext,inArray[i],i);
				}
			}
		}
		
		//单纯的优化后面那个for循环
		function forEach3(inArray,inCallback,inContext){
			for(var i=0,len=inArray.length;i<len;inCallback.call(inContext,inArray[i],i),i++);
		}
		
		
		
	</script>
</body>
</html>